/// Author: QP
/// Version: 1.0
/// Date:2023/05/12
/// 卫生数据类型
/// WS 用于表达所有通过字典约束的类型
Class WS.DT.CodedString [ ClassType = datatype, ClientDataType = VARCHAR, Language = objectscript, OdbcType = VARCHAR, SqlCategory = STRING, System = 2 ]
{

Parameter ValueSet;

ClassMethod IsValid(%val) As %Status
{
    /// 如果设置为“不校验值集”,则直接返回
    Quit:($bit(^WS.Setting.Validation,1)=0) $$$OK
     
    Quit:(..#ValueSet="") $$$ERROR($$$GeneralError,"unassigned valueset")
    
    Set tSC=$$$OK
    Set tValueGlobal= "^WS.VS."_$Replace(..#ValueSet,".","")
    Set:($D(@tValueGlobal@(%val))#2 = 0) tSC=$$$ERROR($$$GeneralError,%val_" 不在值集"_..#ValueSet_"内.")
    Quit tSC
}

}
